// import VueRouter from 'vue-router';
// tips: The right syntax is import * as vueRouter from 'vue-router'; because the vue router doesn't provide default export
// const Home = { template: '<div>Home</div>' }
// tips: Component provided template option but runtime compilation is not supported in this build of Vue
import { createRouter, createWebHashHistory } from 'vue-router';

// 1. Define route components.
// These can be imported from other files
const Home = () => import('@/view/Home.vue')
const About = () => import('@/view/About.vue')
const EleIndex = () => import('@/view/Ele/EleIndex.vue')
const VantIndex = () => import('@/view/Vant/VantIndex.vue')
// 2. Define some routes
// Each route should map to a component.
// We'll talk about nested routes later.
const routes = [
  { path: '/', redirect: '/home' },
  {
    path: '/home',
    component: Home,
    meta: {
      index: '1',
      name: '主页',
    },
    children: [
      {
        path: '/home/ele',
        component: EleIndex,
        meta: {
          index: '1-1',
          name: 'ele演示',
        },
      },
      {
        path: '/home/vant',
        component: VantIndex,
        meta: {
          index: '1-2',
          name: 'vant演示',
        },
      },
      {
        path: '/home/about',
        component: About,
        meta: {
          index: '1-3',
          name: '关于我们',
        },
      },
    ],
  },
]

// 3. Create the router instance and pass the `routes` option
// You can pass in additional options here, but let's
// keep it simple for now.
const router = createRouter({
  // 4. Provide the history implementation to use. We are using the hash history for simplicity here.
  history: createWebHashHistory(),
  routes, // short for `routes: routes`
})


export default router